_package("new_driver.page");

_import("caf.ui.Page");

_class("WelcomePage", Page, function(){
	this._init = function(){
		_super._init.call(this);
	};
	this.create = function(parent){
		var obj = this.createTplElement(parent, "welcome.xml");
		this.init(obj);
		return obj;
	};
	
	this.confirm_clicked = function(sender, act) {  
		switch(act) {  
			case 'dlg_ok':  
				CloudAPI.Device.DeviceStateInfo.wirelessSetting();
				break;  
			case 'dlg_cancel':  
				break;  
			default:  
				break;  
		};  
	};
	
	this.init = function(){
		// 判断是否联网
		if(CloudAPI.Device.DeviceStateInfo.isNetworkAvailable()!=="true"){  
			this._app.dlgInvoke('confirm', this._app, {  
				'title' : '未联网',  
				'msg' : '未检测到连接网络，点击确认后跳转到网络设定页面。'  
			}, this, 'confirm_clicked');  
			// return;
		}
		_super.init.apply(this, arguments);
		this.initComponents();
		this.initActionElements();
	};
	
	this.dispose = function(){
		_super.dispose.apply(this);
	};
	
	/**
	新题测试按钮动作
	*/
	this.do_newTest = function(e){
		this._app.navPage("new_test");
	};
	
	/**
	错题集按钮动作
	*/
	this.do_fixWrong = function(e){
		this._app.navPage("fix_wrong");
	};
	
});